@echo off

set VS_VERSION=Visual Studio 12
set QT_VERSION=D:\Qt\Qt5.9.3\5.9.3\msvc2013

set SOURCE_DIR=%cd%\..
set BUILD_DIR=%SOURCE_DIR%\build\msvc
set PREFIX_DIR=%SOURCE_DIR%\build\install

set BUILD_DEBUG=ON
set BUILD_RELEASE=ON

set BUILD_PACK=ON
::goto :pack

call "%QT_VERSION%\bin\qtenv2.bat"
call "D:\Program Files (x86)\Microsoft %VS_VERSION%.0\VC\vcvarsall.bat"

echo +=============================
echo Start compiling.... It will take about 15 minutes ......
echo +=============================

echo +=============================
echo Start qmake build %QT_VERSION% Win32 Debug and Release ......
echo +=============================

if "x%BUILD_DEBUG%" == "xOFF" goto :release

mkdir %BUILD_DIR%\x32\debug
cd /D %BUILD_DIR%\x32\debug

del *.* /s /f /q

qmake %SOURCE_DIR%\build-all-p3000.pro "CONFIG+=debug" "CYG_PREFIX+=%PREFIX_DIR%" >> "qmake-build-msvc.log"
D:/Qt/Qt5.9.3/Tools/QtCreator/bin/jom.exe         >> "qmake-build-msvc.log"
D:/Qt/Qt5.9.3/Tools/QtCreator/bin/jom.exe install >> "qmake-build-msvc.log"

:release
if "x%BUILD_RELEASE%" == "xOFF" goto :end

mkdir %BUILD_DIR%\x32\release
cd /D %BUILD_DIR%\x32\release

del *.* /s /f /q

qmake %SOURCE_DIR%\build-all-p3000.pro "CONFIG+=release" "CYG_PREFIX+=%PREFIX_DIR%" >> "qmake-build-msvc.log"
D:/Qt/Qt5.9.3/Tools/QtCreator/bin/jom.exe           >> "qmake-build-msvc.log"
D:/Qt/Qt5.9.3/Tools/QtCreator/bin/jom.exe install   >> "qmake-build-msvc.log"

:end
pause
